<!DOCTYPE html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>目录</title>
    <link href="../layui/css/layui.css" rel="stylesheet" type="text/css">
    <link href="../css/style.css" rel="stylesheet" type="text/css">
    <link href="../../layui/css/iconfont/iconfont.css" rel="stylesheet" type="text/css">
    <script src="../layui/layui.js"></script>
    <script src="../js/jquery-1.8.3.js"></script>
    <script src="../js/util.js"></script>
    <script>
        layui.use(['element', 'jquery', 'layer'], function () {
            var $ = layui.$;
            var element = layui.element;
            var layer = layui.layer;
            var url = '/menu';
            //身份识别
            $(document).ready(function () {
                $.ajax({
                    type: 'post',
                    async: false,
                    url: '/util/findUser',
                    success: function (json) {
                       $("#userName").text(json.userName); 
                    }, error: function () {
                        layer.msg('系统异常，请联系管理员处理!');
                    }
                });
            });
            $.ajax({
                type: 'post',
                url: url,
                async: false,
                success: function (json) {
                    if (json.code == '0') {
                        openMenu(json.data);
                    } else {
                        layer.msg(json.msg);
                    }
                },
                error: function () {
                    layer.msg('系统异常，请联系管理员处理!');
                }
            });
            $.ajax({
                type: 'post',
                async: false,
                url: '/util/findUser',
                success: function (json) {
                    user = json;
                    if (json.duty == 0||json.duty == 1||json.duty == 2||json.duty == 3||json.duty == 4||json.duty == 5) {
                        $('iframe').attr('src', './mgrTemplateManage/smsMgrTemplateManage.html');
                    } else  {
                        $('iframe').attr('src', './xuyiview/xuyiIndex.html');
                    }
                }, error: function () {
                    layer.msg('系统异常，请联系管理员处理!');
                }
            });
            function openMenu(data) {
                //var content = '<li class="layui-nav-logo">';
                //content += '<img src="../images/logo.png" style="height: 40px" onclick="returnIndex()"> </li>';
                var content='';
                for (var i = 0; i < data.length; i++) {
                    content += '<li class="layui-nav-item">';
                    content += '<a href="javascript:;">' + data[i].functionName + '</a>';
                    var data1 = data[i].list;
                    if (data1.length > 0) {
                        content += '<dl class="layui-nav-child">';
                        for (var j = 0; j < data1.length; j++) {
                            content += '<dd><a href="' + data1[j].functionUrl + '" ' +
                                'target="show">' + data1[j].functionName + '</a></dd>';
                        }
                        content += '</dl>';
                    } else {
                        content += '</li>';
                    }

                }
                //content+='<li style="float:right; " class="layui-nav-logo"><a href="/exit" style="color: #FFFFFF;text-decoration: underline;"> 退出</a></li>';
                $('#nav').html(content);
                element.render();
            }
        });
        
    </script>
    <style>
        .layui-nav{
            overflow: auto;
            z-index:200;
        }
        .layui-nav>li:last-child{
            margin-bottom:33px;
        }
        ::-webkit-scrollbar {
            overflow-y:hidden;
        }
    </style>
</head>
<body>
<!-- <div class="layui-html-limit">
    <ul class="layui-nav layui-bg-blue layui-nav-fixed" lay-filter="nav" id="nav">
    </ul>
    <div style="height:100%;">
        <iframe style="width:100%;height:100%" frameborder="0" name="show" scrolling="no"></iframe>
    </div>
</div> -->
<div class="layui-html-limit">
    <div class="nav-bar"><span class="iconfont icon-yidong logo"></span> 应急信息发布平台
    <li style="float:right; " class="layui-nav-logo">
    <span style="font-size: 16px;vertical-align: middle;" class="iconfont icon-ArtboardCoshipy"></span>
    	<span id="userName" style="font-size: 14px;margin-right: 3px;border-right: 1px solid #9eb0ea;padding-right: 8px;vertical-align: middle;"></span>
    	<a href="/exit" style="color: #FFFFFF;text-decoration:none;font-size: 14px;"> 退出</a></li>
    </div>
    
    <ul class="layui-nav layui-nav-tree" lay-filter="nav" id="nav">
       
    </ul>
    <div class="content-body">
        <iframe style="width:100%;height:100%" frameborder="0" name="show" scrolling="no"></iframe>
    </div>
</div>
</body>
</html>